package com.heima.common.tess4j;

import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.TesseractException;

import java.io.File;

public class tess4jApplicationTest {
    public static void main(String[] args) throws TesseractException {
        File file = new File("D:\\html\\1.jpg");
        Tesseract tesseract = new Tesseract();
        tesseract.setDatapath("D:\\html");
        tesseract.setLanguage("chi_sim");
        String result = tesseract.doOCR(file);
        result.replaceAll("\\r|\\n","-").replaceAll(" ","");
        System.out.println("识别结果为"+result);
    }
}
